const Service = require('egg').Service

class addNoteService extends Service {
    async find(data) {
        const { ctx } = this

        const user = await ctx.model.Notes.findOne({
            where: {
                title: data.title
            }
        })

        return user
    }

    async addResult(data) {
        const { ctx } = this

        const user = await ctx.model.Notes.create({
            title: data.title,
            content: data.content,
            dateTime: data.time,
            upload: data.url,
            userID: data.id
        })

        return user
    }
}

module.exports = addNoteService